package com.ics.web.controller.travelstar.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ics.framework.util.PageUtil;
import com.ics.web.controller.travelstar.domain.TiresFAQs;
import com.ics.web.controller.travelstar.dto.TiresFAQsDTO;
import com.ics.web.controller.travelstar.mapper.TiresFAQsMapper;
import com.ics.web.controller.travelstar.service.ITiresFAQsService;
import lombok.extern.java.Log;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * @author shaoly
 * @description
 * @ClassName ITiresFAQsServiceImpl.java
 * @createTime 2024年09月24日 13:34:38
 */
@Service
@Log
public class ITiresFAQsServiceImpl extends ServiceImpl<TiresFAQsMapper, TiresFAQs> implements ITiresFAQsService {


    @Override
    public IPage<TiresFAQs> listPage(TiresFAQsDTO faQsDTO) {
        LambdaQueryWrapper<TiresFAQs> wrapper = Wrappers.lambdaQuery();
        wrapper.orderByAsc(TiresFAQs::getFqOrder);
        if (StringUtils.isNotBlank(faQsDTO.getTitle())) {
            wrapper.like(TiresFAQs::getTitle, faQsDTO.getTitle());
        }
        if (StringUtils.isNotBlank(faQsDTO.getContent())) {
            wrapper.like(TiresFAQs::getContent, faQsDTO.getContent());
        }
        if (StringUtils.isNotBlank(faQsDTO.getBigType())) {
            wrapper.eq(TiresFAQs::getBigType, faQsDTO.getBigType());
        }
        if (StringUtils.isNotBlank(faQsDTO.getSmallType())) {
            wrapper.eq(TiresFAQs::getSmallType, faQsDTO.getSmallType());
        }
        return this.baseMapper.selectPage(PageUtil.getPage(faQsDTO), wrapper);
    }
}
